package testcaes.login.favorites;

import appium1.common.BasicTestCase;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;

import org.testng.annotations.Test;

public class AddToFavorite extends BasicTestCase {
    @Test
    public void testAddToFavorite()throws  Exception{
        pageManager.getPageCommon().gotoMyTab();
        pageManager.getPagemysetings().clickLoginIcon();
        pageManager.getPageLogin().login("735723619@qq.com","12345678");
        pageManager.getPageCommon().goToHomeTab();

        String expectednewTtitle=pageManager.getPageHome().getNewTitle(10);
        System.out.println("获取到的标题是:------"+expectednewTtitle);
        pageManager.getPageHome().clickNewsTiele(10);
        pageManager.getPageNewsDetail().clickAddtoFavoriBtn();
        Thread.sleep(1000);
        pageManager.getPageNewsDetail().clickBackBtn();
        pageManager.getPageCommon().gotoMyTab();
        pageManager.getPagemysetings().clickFavorit();
        assertTrue(expectednewTtitle.contains(pageManager.getPageUserFavoriteList().getFavoritesTitlt(1)));
    }
}
